/*     */ package com.zimbra.qa.unittest;
/*     */ 
/*     */ import com.zimbra.client.ZFeatures;
/*     */ import com.zimbra.client.ZGetInfoResult;
/*     */ import com.zimbra.client.ZMailbox;
/*     */ import com.zimbra.client.ZMailbox.Options;
/*     */ import com.zimbra.client.ZPrefs;
/*     */ import com.zimbra.client.ZSignature;
/*     */ import com.zimbra.common.account.Key.AccountBy;
/*     */ import com.zimbra.common.soap.SoapFaultException;
/*     */ import com.zimbra.cs.account.Account;
/*     */ import java.util.List;
/*     */ import junit.framework.TestCase;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class TestZClient
/*     */   extends TestCase
/*     */ {
/*     */   private static final String USER_NAME = "user1";
/*     */   
/*     */   public void setUp()
/*     */     throws Exception
/*     */   {
/*  42 */     cleanUp();
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   public void testPrefs()
/*     */     throws Exception
/*     */   {
/*  50 */     Account account = TestUtil.getAccount("user1");
/*  51 */     ZMailbox mbox = TestUtil.getZMailbox("user1");
/*  52 */     ZPrefs prefs = mbox.getPrefs();
/*  53 */     assertEquals(account.getPrefLocale(), prefs.getLocale());
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   public void testFeatures()
/*     */     throws Exception
/*     */   {
/*  61 */     ZMailbox mbox = TestUtil.getZMailbox("user1");
/*  62 */     ZFeatures features = mbox.getFeatures();
/*  63 */     features.getPop3Enabled();
/*     */   }
/*     */   
/*     */   public void testChangePassword() throws Exception
/*     */   {
/*  68 */     Account account = TestUtil.getAccount("user1");
/*  69 */     ZMailbox.Options options = new ZMailbox.Options();
/*  70 */     options.setAccount(account.getName());
/*  71 */     options.setAccountBy(Key.AccountBy.name);
/*  72 */     options.setPassword("test123");
/*  73 */     options.setNewPassword("test456");
/*  74 */     options.setUri(TestUtil.getSoapUrl());
/*  75 */     ZMailbox.changePassword(options);
/*     */     try
/*     */     {
/*  78 */       TestUtil.getZMailbox("user1");
/*     */     } catch (SoapFaultException e) {
/*  80 */       assertEquals("account.AUTH_FAILED", e.getCode());
/*     */     }
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */   public void testModifySignatures()
/*     */     throws Exception
/*     */   {
/*  90 */     ZMailbox mbox = TestUtil.getZMailbox("user1");
/*  91 */     List<ZSignature> signatures = mbox.getSignatures();
/*     */     try {
/*  93 */       signatures.set(signatures.size(), null);
/*     */     }
/*     */     catch (IndexOutOfBoundsException e) {}
/*     */     
/*     */ 
/*  98 */     ZGetInfoResult info = mbox.getAccountInfo(true);
/*  99 */     signatures = info.getSignatures();
/*     */     try {
/* 101 */       signatures.set(signatures.size(), null);
/*     */     }
/*     */     catch (IndexOutOfBoundsException e) {}
/*     */   }
/*     */   
/*     */   public void tearDown()
/*     */     throws Exception
/*     */   {
/* 109 */     cleanUp();
/*     */   }
/*     */   
/*     */   private void cleanUp() throws Exception
/*     */   {
/* 114 */     Account account = TestUtil.getAccount("user1");
/* 115 */     account.setPassword("test123");
/*     */   }
/*     */   
/*     */   public static void main(String[] args) throws Exception
/*     */   {
/* 120 */     TestUtil.cliSetup();
/* 121 */     TestUtil.runTest(TestZClient.class);
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/qa/unittest/TestZClient.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */